home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / packet / terminal / top_152 / src152.exe / rar / TOPMON.PAS < prev    next >
Pascal/Delphi Source File  |  1995-05-16  |  10KB  |  366 lines

  1. {┌─────────────────────────────────────────────────────────────────────────┐}
  2. {│                                                                         │}
  3. {│                              T. O. P.                                   │}
  4. {│                                                                         │}
  5. {│                        (T)he  (O)ther  (P)acket                         │}
  6. {│                                                                         │}
  7. {│ T O P M O N . P A S                                                     │}
  8. {│                                                                         │}
  9. {│                                                                         │}
  10. {│                                                                         │}
  11. {│ Routinen für das Monitoren auf einem QSO-Kanal                          │}
  12. {│                                                                         │}
  13. {│                                                                         │}
  14. {└─────────────────────────────────────────────────────────────────────────┘}
  15.  
  16.  
  17. Procedure Stat_MonitorCalls (* Kanal : Byte *);
  18. Var  Ch : Char;
  19. Begin
  20.   with K[Kanal]^ do
  21.   begin
  22.     with Mo do
  23.     begin
  24.       if MonActive then
  25.       begin
  26.         if MonBeide then Ch := #29 else Ch := #26;
  27.         StatusOut(Kanal,2,2,Attrib[25],EFillStr(19,B1,CutStr(MonStr[1]) +
  28.                                     Ch + RestStr(RestStr(MonStr[1]))));
  29.       end else StatusOut(Kanal,2,2,Attrib[9],ConstStr(B1,19));
  30.     end;
  31.     StatusOut(Kanal,4,1,Attrib[9],EFillStr(9,B1,OwnCall));
  32.     Status2;
  33.   end;
  34. End;
  35.  
  36.  
  37. Procedure Calls_Monitoren (* Kanal : Byte; Zeile : Str80 *);
  38. Const  ArtMax = 11;
  39.  
  40. Var    i,i1,
  41.        X,Y,
  42.        Art,
  43.        aktiv : Byte;
  44.        Flag,
  45.        ZFlag,
  46.        DisAbr,
  47.        Beide,
  48.        HCall,
  49.        EHCall,
  50.        Strict,
  51.        Signal,
  52.        IFr,UFr  : Boolean;
  53.        Hstr     : String[19];
  54.        KC       : Sondertaste;
  55.        VC       : Char;
  56.  
  57.   Procedure InitKanal(Kanal : Byte);
  58.   Begin
  59.     with K[Kanal]^.Mo do
  60.     begin
  61.       DisAbr := MonDisAbr;
  62.       Beide  := MonBeide;
  63.       Strict := MonStrict;
  64.       HCall  := MonHCall;
  65.       EHCall := MonEHCall;
  66.       Signal := MonSignal;
  67.       IFr    := MonIFr;
  68.       UFr    := MonUFr;
  69.     end;
  70.   End;
  71.  
  72.   Procedure Ins_Auswert(Istr : Str20);
  73.   Var Flag : Boolean;
  74.   Begin
  75.     Flag := pos(B1,Zeile) = 0;
  76.     DisAbr := not Flag;
  77.     Beide := true;
  78.     HCall := true;
  79.     EHCall := true;
  80.     Strict := not Flag;
  81.     Signal := true;
  82.     IFr := true;
  83.     UFr := false;
  84.   End;
  85.  
  86. Begin
  87.   with K[Kanal]^ do
  88.   begin
  89.     InitKanal(Kanal);
  90.     KillEndBlanks(Zeile);
  91.     ZFlag := Zeile > '';
  92.  
  93.     if not Mo.MonActive then
  94.     begin
  95.       if (Zeile > '') then Ins_Auswert(Zeile);
  96.     end else
  97.     begin
  98.       Zeile := CutStr(Mo.MonStr[1]) + B1 + CutStr(Mo.MonStr[2]);
  99.       KillEndBlanks(Zeile);
  100.     end;
  101.  
  102.     for i := 9 to 15 do G^.Fstx[i] := 2;
  103.     G^.Fstr[7]  := InfoZeile(304);
  104.     G^.Fstr[9]  := InfoZeile(305);
  105.     G^.Fstr[10] := InfoZeile(306);
  106.     G^.Fstr[11] := InfoZeile(307);
  107.     G^.Fstr[12] := InfoZeile(308) + B1 + Zeile;
  108.     G^.Fstr[13] := InfoZeile(309);
  109.     G^.Fstr[14] := InfoZeile(310);
  110.     G^.Fstr[15] := InfoZeile(311);
  111.  
  112.     Flag := false;
  113.  
  114.     if ZFlag and not Mo.MonActive then Art := 8 else
  115.      if not ZFlag and Mo.MonActive then Art := 10 else
  116.       if not ZFlag then Art := 11
  117.                    else Art := 1;
  118.  
  119.     Repeat
  120.       for i := 9 to 15 do
  121.       begin
  122.         G^.Fstr[i][vM+1] := B1;
  123.         G^.Fstr[i][hM+1] := B1;
  124.         G^.Fstr[i][vM] := B1;
  125.         G^.Fstr[i][hM] := B1;
  126.       end;
  127.  
  128.       if Art in [1..7] then
  129.       begin
  130.         X := vM;
  131.         Y := Art + 8;
  132.       end else
  133.       begin
  134.         X := hM;
  135.         Y := Art + 1;
  136.       end;
  137.  
  138.       G^.Fstr[Y][X] := A_ch;
  139.       if HardCur then SetzeCursor(X+1,Y);
  140.  
  141.       if DisAbr then  G^.Fstr[9][vM+1] := X_ch;
  142.       if Beide  then G^.Fstr[10][vM+1] := X_ch;
  143.       if HCall  then G^.Fstr[11][vM+1] := X_ch;
  144.       if EHCall then G^.Fstr[12][vM+1] := X_ch;
  145.       if Strict then G^.Fstr[13][vM+1] := X_ch;
  146.       if IFr    then G^.Fstr[14][vM+1] := X_ch;
  147.       if Signal then G^.Fstr[15][vM+1] := X_ch;
  148.       if Zeile > '' then G^.Fstr[12][hM+1] := X_ch;
  149.  
  150.       aktiv := 0;
  151.       if Zeile > '' then
  152.       begin
  153.         for i := 1 to maxLink do with K[i]^.Mo do
  154.         begin
  155.           if MonActive and (i <> Kanal) and
  156.             ((Zeile = (CutStr(MonStr[1]) + B1 + CutStr(MonStr[2]))) or
  157.              (Zeile = (CutStr(MonStr[2]) + B1 + CutStr(MonStr[1])))) then
  158.           aktiv := i;
  159.         end;
  160.       end;
  161.  
  162.       if aktiv > 0 then
  163.       begin
  164.         delete(G^.Fstr[13],hM,2);
  165.         insert(SFillStr(2,B1,int_str(aktiv)),G^.Fstr[13],hM);
  166.       end;
  167.  
  168.       Fenster;
  169.  
  170.       _ReadKey(KC,VC);
  171.        Case KC of
  172.          _Esc : Flag := true;
  173.          _Ret :;
  174.  
  175.           _F1 : Art := 1;
  176.           _F2 : Art := 2;
  177.           _F3 : Art := 3;
  178.           _F4 : Art := 4;
  179.           _F5 : Art := 5;
  180.           _F6 : Art := 6;
  181.           _F7 : Art := 7;
  182.          _Back: Art := 8;
  183.          _End : Art := 9;
  184.          _Del : Art := 10;
  185.          _Ins : Art := 11;
  186.  
  187.         _AltH : TOP_Help(G^.OHelp[10]);
  188.  
  189.           _Up : if Art > 1  then dec(Art)
  190.                             else Alarm;
  191.  
  192.           _Dn : if Art < ArtMax then inc(Art)
  193.                                 else Alarm;
  194.        _Right : if Art < ArtMax  then
  195.                 begin
  196.                   Art := Art + 7;
  197.                   if Art > ArtMax then Art := ArtMax;
  198.                 end else Alarm;
  199.  
  200.         _Left : if Art > 1 then
  201.                 begin
  202.                   if Art <= 7 then Art := 1
  203.                               else Art := Art - 7;
  204.                 end else Alarm;
  205.  
  206.  
  207.       _Andere : case VC of
  208.                   B1:;
  209.                   else Alarm;
  210.                 end;
  211.  
  212.           else Alarm;
  213.        End;
  214.  
  215.       if (KC in [_F1.._F7,_Ret,_End,_Back,_Del,_Ins]) or
  216.          ((KC = _Andere) and (VC = B1)) then
  217.       case Art of
  218.         1 : DisAbr := not DisAbr;
  219.         2 : Beide := not Beide;
  220.         3 : HCall := not HCall;
  221.         4 : begin
  222.               EHCall := not EHCall;
  223.               if EHCall then HCall := true;
  224.             end;
  225.         5 : Strict := not Strict;
  226.         6 : begin
  227.               IFr := not IFr;
  228.               UFr := not IFr;
  229.               if UFr then
  230.               begin
  231.                 DisAbr := false;
  232.                 Strict := false;
  233.               end;
  234.             end;
  235.         7 : Signal := not Signal;
  236.         8 : begin
  237.               if Zeile > '' then with Mo do
  238.               begin
  239.                 Init_Call_Monitoren(Kanal,Zeile);
  240.                 MonDisAbr := DisAbr;
  241.                 MonBeide := Beide;
  242.                 MonHCall := HCall;
  243.                 MonEHCall := EHCall;
  244.                 MonStrict := Strict;
  245.                 MonSignal := Signal;
  246.                 MonIFr := IFr;
  247.                 MonUFr := UFr;
  248.                 Flag := true;
  249.               end else Alarm;
  250.             end;
  251.         9 : begin
  252.               if Mo.MonActive then for i := 1 to 2 do with Mo do
  253.               begin
  254.                 MonFrameNr[i] := 0;
  255.                 MonFirst[i] := true;
  256.                 MonLast := '';
  257.                 for i1 := 0 to 7 do MonCtrl[i][i1] := 0;
  258.               end else Alarm;
  259.             end;
  260.         10: begin
  261.               Cancel_Call_Monitoren(Kanal);
  262.               Flag := true;
  263.             end;
  264.         11: begin
  265.               Hstr := Zeile;
  266.               GetString(Hstr,Attrib[3],19,length(InfoZeile(308))+3,12,KC,0,Ins);
  267.               if KC <> _Esc then
  268.               begin
  269.                 Zeile := Hstr;
  270.                 KillEndBlanks(Zeile);
  271.                 G^.Fstr[12] := InfoZeile(308) + B1 + Zeile;
  272.                 if not ZFlag and not Mo.MonActive then Ins_Auswert(Zeile);
  273.               end;
  274.             end;
  275.       end;
  276.     Until Flag;
  277.  
  278.     Stat_MonitorCalls(Kanal);
  279.   end;
  280.   ClrFenster;
  281.   Neu_Bild;
  282. End;
  283.  
  284.  
  285. Procedure Init_Call_monitoren (* Kanal : Byte; Zeile : Str80 *);
  286. Var   i,i1 : Byte;
  287. Begin
  288.   with K[Kanal]^ do
  289.   begin
  290.     with Mo do
  291.     begin
  292.       KillEndBlanks(Zeile);
  293.  
  294.       MonStr[1] := CutStr(Zeile) + zu + RestStr(Zeile);
  295.       KillEndBlanks(MonStr[1]);
  296.  
  297.       MonStr[2] := RestStr(Zeile) + zu + CutStr(Zeile);
  298.       KillEndBlanks(MonStr[2]);
  299.  
  300.       for i := 1 to 2 do
  301.       begin
  302.         MonFrameNr[i] := 0;
  303.         MonFirst[i] := true;
  304.         for i1 := 0 to 7 do MonCtrl[i][i1] := 0;
  305.       end;
  306.       MonLast := '';
  307.       MonActive := true;
  308.     end;
  309.     Mon_Anz := 0;
  310.     for i := 1 to maxLink do if K[i]^.Mo.MonActive then inc(Mon_Anz);
  311.     S_PAC(Kanal,CM,true,'I ' + PhantasieCall);
  312.     Kanal_benutz := true;
  313.     Stat_MonitorCalls(Kanal);
  314.   end;
  315. End;
  316.  
  317.  
  318. Procedure Cancel_Call_monitoren (* Kanal : Byte *);
  319. Var  i,i1 : Byte;
  320. Begin
  321.   with K[Kanal]^ do
  322.   begin
  323.     with Mo do
  324.     begin
  325.       MonActive := false;
  326.       MonDisAbr := false;
  327.       MonBeide := false;
  328.       MonHCall := false;
  329.       MonEHCall := false;
  330.       MonStrict := false;
  331.       MonSignal := false;
  332.       for i := 1 to 2 do
  333.       begin
  334.         MonNow[i] := false;
  335.         MonStr[i] := '';
  336.         MonFrameNr[i] := 0;
  337.         MonFirst[i] := false;
  338.         for i1 := 0 to 7 do MonCtrl[i][i1] := 0;
  339.       end;
  340.       MonLast := '';
  341.     end;
  342.     if Mon_Anz > 0 then dec(Mon_Anz);
  343.     S_PAC(Kanal,CM,true,'I '+ OwnCall);
  344.     Kanal_benutz := false;
  345.     TxComp := false;
  346.     RxComp := false;
  347.     SetzeFlags(Kanal);
  348.     Stat_MonitorCalls(Kanal);
  349.   end;
  350. End;
  351.  
  352.  
  353. Procedure FreeMonitorKanal (* Var KA : Byte; Zeile : Str80 *);
  354. Var  Flag : Boolean;
  355.      i    : Byte;
  356. Begin
  357.   Flag := false;
  358.   i := 1;
  359.   While (i <= maxLink) and not Flag do with K[i]^.Mo do
  360.   begin
  361.     if MonActive and (MonStr[1] = Zeile) then Flag := true
  362.                                          else inc(i);
  363.   end;
  364.   if Flag then KA := i else KA := KanalFrei(0);
  365. End;
  366.